package babo;

public class SumEx implements Runnable{
	public void run()
	{
		try{
			doJob();
		}catch(Exception e){
			e.printStackTrace();
		}
	}
	public void doJob() throws Exception{
		int sum = 0;
		for(int i=1; i<=100; i++)
		{
			sum=sum+i;
			Thread.sleep(100);
			System.out.println(sum);
		}
	}
	
	public static void main(String[] args)throws Exception
	{
		SumEx ex = new SumEx();
//		ex.doJob();
		
		Thread t0 = new Thread(ex);
		Thread t1 = new Thread(ex);
		t0.start();
		t1.start();
		System.out.println("---------------------");
	}
}
